const isTree = param => {
    return param
    && (typeof param.source === 'object' || param.type === 'Function');
};


// 设置摘要显示的内容
const setShowValue = param => {
    const {origin} = param;

    switch (param.type) {
        case 'Undefined':
            return 'undefined';
        case 'Object':
            const reg = /("[^",]*":)/g;
            return origin === null
                ? 'null'
                : JSON.stringify(origin)
                    .replaceAll(reg, a => {
                        return a.replaceAll('"', '');
                    })
                    .replaceAll('"ƒ"', 'ƒ')
                    .replaceAll(':', ': ')
                    .replaceAll(',', ', ');
        case 'Function':
            return `ƒ ${param.funcName} ()`;
        case 'String':
            return `${origin}`;
        case 'Array':
            return `(${origin.length})`;
        default:
            return origin;
    }
};


export {
    isTree,
    setShowValue,
};
